<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
require_once MODEL_PATH.'/MY_Model.php';
class Resources_m extends MY_Model {

    
	function __construct($db=null) {
		parent::__construct($db);
	}

    function getResource($params = array()) {

    	if(isset($params['name'])) {
    		$this->db->where('name', $params['name']);
    	}

    	$query = $this->db->get('admin_acl_resources');
    	if ($query->num_rows() == 0)
    		return false;
    	else
    		return $query->row();
    }

    function newResource($input = array())
    {
    	$row = array(
			'name'			=> $input['name']
			, 'description'	=> $input['description']
			, 'parent_id'	=> $input['parent_id']
		);
        $this->db->insert('admin_acl_resources', $row);
		return $this->db->insert_id();
	}
}

?>